package com.ruoyi.community.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.community.domain.vo.ComplainVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.ComplainMapper;
import com.ruoyi.community.domain.Complain;
import com.ruoyi.community.service.IComplainService;

/**
 * 投诉意见Service业务层处理
 *
 * @author lj
 * @date 2022-02-22
 */
@Service
public class ComplainServiceImpl implements IComplainService
{
    @Autowired
    private ComplainMapper complainMapper;

    /**
     * 查询投诉意见
     *
     * @param id 投诉意见主键
     * @return 投诉意见
     */
    @Override
    public Complain selectComplainById(Long id)
    {
        return complainMapper.selectComplainById(id);
    }

    /**
     * 查询投诉意见列表
     *
     * @param complain 投诉意见
     * @return 投诉意见
     */
    @Override
    public List<Complain> selectComplainList(Complain complain)
    {
        return complainMapper.selectComplainList(complain);
    }

    @Override
    public List<ComplainVo> selectComplainLists(Complain complain) {
        return complainMapper.selectComplainLists(complain);
    }

    /**
     * 新增投诉意见
     *
     * @param complain 投诉意见
     * @return 结果
     */
    @Override
    public int insertComplain(Complain complain)
    {
        complain.setCreatTime(DateUtils.getNowDate());
        complain.setUpdateTime(DateUtils.getNowDate());
        complain.setDelFlag(0);
        return complainMapper.insertComplain(complain);
    }

    /**
     * 修改投诉意见
     *
     * @param complain 投诉意见
     * @return 结果
     */
    @Override
    public int updateComplain(Complain complain)
    {
        complain.setUpdateTime(DateUtils.getNowDate());
        return complainMapper.updateComplain(complain);
    }

    /**
     * 批量删除投诉意见
     *
     * @param ids 需要删除的投诉意见主键
     * @return 结果
     */
    @Override
    public int deleteComplainByIds(Long[] ids)
    {
        return complainMapper.deleteComplainByIds(ids);
    }

    /**
     * 删除投诉意见信息
     *
     * @param id 投诉意见主键
     * @return 结果
     */
    @Override
    public int deleteComplainById(Long id)
    {
        return complainMapper.deleteComplainById(id);
    }

    /**
     * 批量更改投诉意见删除标志
     *
     * @param ids 需要删除的投诉意见主键集合
     * @return 结果
     */
    @Override
    public int updateComplainByIds(Long[] ids) {
        return complainMapper.updateComplainByIds(ids);
    }
}
